package com.example.tests;

import java.util.Set;

import org.testng.annotations.Test;

public class ContactModifyTests extends TestBase {

    @Test
    public void testFirstContactCanBeModified() throws Exception {
		ContactObject modifiedContact = new ContactObject()
			.setFirstname("Yury")
			.setLastname("Shustov")
			.setAddress("Moscow")
			.setHome("22")
			.setMobile("44")
			.setWork("55")
			.setEmail("sss@ru.ru")
			.setEmail2("ttt@ru.ru")
			.setBday("2")
			.setBmonth("February")
			.setByear("2002")
			.setGroup("gr1")
			.setAddress2("Out There")
			.setPhone2("77");
		Set<ContactObject> oldList = app.getContactHelper().getContacts();
		if (oldList.size() == 0){			
			ContactObject contactObject = new ContactObject()
			.setFirstname("")
			.setLastname("")
			.setAddress("")
			.setHome("")
			.setMobile("")
			.setWork("")
			.setEmail("")
			.setEmail2("")
			.setBday("1")
			.setBmonth("January")
			.setByear("2001")
			.setGroup("[none]")
			.setAddress2("")
			.setPhone2("");
			app.getContactHelper().createContact(contactObject);
		    oldList.add(contactObject);
		}
		app.getContactHelper().modifyContact(0, modifiedContact);
		Set<ContactObject> newList = app.getContactHelper().getContacts();
		verifyContactModified(oldList, newList);
    }	

}